package com.job.DQH.dqh714.inClass;

public class Beauty implements Cloneable{
    private String name;
    private Cat cat;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Cat getCat() {
        return cat;
    }

    public void setCat(Cat cat) {
        this.cat = cat;
    }

    public Beauty() {
    }

    public Beauty(String name, Cat cat) {
        this.name = name;
        this.cat = cat;
    }

    public static void main(String[] args) throws CloneNotSupportedException {
        Cat cat = new Cat("TomCat");
        Beauty beauty = new Beauty("Alice",cat);

        Beauty clone = (Beauty) beauty.clone();//由于.clone()是protected权限，只能在beauty类中使用
        System.out.println(clone == beauty);//f
        System.out.println(clone.cat == beauty.cat);//t
    }
}
